/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <iostream>
#include <set>
#include <cstdlib>
#include <ctime>
using namespace std;
void showEach(auto &container)
{
    cout << "The size of container is "<<container.size() << endl;
    for(auto elem:container)
    {
        cout << elem << " ";
    }
    cout << endl;
}
void showIter(auto &container)
{
    cout << "The size of container is "<<container.size() << endl;
    for (auto i=container.begin(); i!=container.end() ; ++i )
    {
        cout << *i << " ";
    }
    cout << endl;
}
void findInt(auto container,int integer)
{
    if (container.find(integer)!=container.end())
    {
        cout << integer<<" exists in the container" << endl;
    }
    else
    {
        cout << integer<<" doesn't exist in the container" << endl;
    }
}
int main_26()
{
    srand((unsigned int)time(nullptr));
    set<int,greater<int>> int_set;
    multiset<int> int_multiset;
    int random_int;
    for (int i=0; i<20 ; ++i )
    {
        random_int=rand()%50;
        int_set.insert(random_int);
        int_multiset.insert(random_int);
    }
    random_int=rand()%50;
    cout << "The number of "<<random_int<<" in set is "<<int_set.count(random_int) << endl;
    cout << "set" << endl;
    showEach(int_set);
    showIter(int_set);
    findInt(int_set,random_int);
    if (int_set.erase(random_int)>0)
    {
        cout << random_int<<" has been erased." << endl;
    }
    cout << "set has been cleared" << endl;
    int_set.clear();
    random_int=rand()%50;
    cout << "The number of "<<random_int<<" in multiset is "<<int_multiset.count(random_int) << endl;
    cout << "multiset" << endl;
    showEach(int_multiset);
    showIter(int_multiset);
    findInt(int_multiset,random_int);
    if (int_multiset.erase(random_int)>0)
    {
        cout << random_int<<" has been erased." << endl;
    }
    cout << "multiset has been cleared" << endl;
    int_multiset.clear();
    return 0;
}
